/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.modules.biz.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author Admin
 * @website https://eladmin.vip
 * @description /
 * @date 2023-03-13
 **/
@Entity
@Data
@Table(name = "hj_storehouse_order_detail")
public class StorehouseOrderDetail implements Serializable {

    public static final int GENRE_YI_LEI_YI_MA = 1;
    public static final int GENRE_YI_PING_YI_MA = 2;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`hj_hazardous_chemical_id`")
    @ApiModelProperty(value = "hjHazardousChemicalId")
    private Integer hjHazardousChemicalId;

    @Column(name = "`number`")
    @ApiModelProperty(value = "数量")
    private Float number;

    @Column(name = "`lab_id`")
    @ApiModelProperty(value = "实验室ID")
    private Integer labId;

    @Column(name = "`order_id`")
    @ApiModelProperty(value = "订单ID")
    private Integer orderId;

    @Column(name = "`cabinet_id`")
    @ApiModelProperty(value = "柜子ID")
    private Integer cabinetId;

    @Column(name = "`count_type`")
    @ApiModelProperty(value = "计数类型(1.重量 2.数量)")
    private Integer countType = 1;//这个字段没什么用，已废弃，固定1就好了

    @Column(name = "`name`")
    @ApiModelProperty(value = "名字")
    private String name;

    @Column(name = "`created_at`")
    @CreationTimestamp
    @ApiModelProperty(value = "createdAt")
    private Timestamp createdAt;

    @Column(name = "`updated_at`")
    @UpdateTimestamp
    @ApiModelProperty(value = "updatedAt")
    private Timestamp updatedAt;

    //1 一类一码  2 一瓶一码
    @Column(name = "`genre`")
    private Integer genre = GENRE_YI_PING_YI_MA;

//    @Column(name="capacity")
//    @ApiModelProperty(value = "容量")
//    private Float capacity;

    @Column(name = "`num`")
    @ApiModelProperty(value = "申领数量")
    private Float num;

    @Column(name = "`real_num`")
    @ApiModelProperty(value = "实际数量")
    private Float realNum;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(name = "`category`")
    private String category;

    @Column(name = "type")
    private int type;

    @Column(name = "status")
    private int status;

    @Column(name = "`claim_detail_number`")
    @ApiModelProperty(value = "领用详细数量")
    private Float claimDetailNumber;

    @Column(name = "`return_detail_number`")
    @ApiModelProperty(value = "归还详细数量")
    private Float returnDetailNumber;

    public void copy(StorehouseOrderDetail source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
